package br.com.maven.plugins.buildinfo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.model.Profile;

public class ProfileHelper {

	public static List<ProfileWrapper> wrapp(List<Profile> list) {
		ArrayList<ProfileWrapper> result = new ArrayList<ProfileWrapper>();
		for(Profile p : list) {
			result.add(new ProfileWrapper(p));
		}
		return result;
	}
	
	public static List<Profile> unWrapp(Collection<ProfileWrapper> list) {
		ArrayList<Profile> result = new ArrayList<Profile>();
		for(ProfileWrapper pw : list) {
			result.add(pw.getContent());
		}
		return result;
	}

	public static String desc(List<Profile> list) {
		String profs = "[";
		for(Iterator<Profile> it = list.iterator(); it.hasNext();) {
			if(!profs.equals("[")) profs += ", ";
			profs += it.next().getId();
		}
		profs += "]";
		
		return profs;
	}
	
	
}
